<?php
//好物频道改版 福利社板块新增住友参与人数
error_reporting(E_ALL ^ E_NOTICE);
require_once '/data/wwwroot/g_vendor/autoload.php';


use Biz\model\bigData\DailyReportWelfareClubUser as mDailyReportWelfareClubUser;
use Doraemon\tools\Log;

try {
    $day = date('Ymd', strtotime('-1 days'));
    $uvRes = mDailyReportWelfareClubUser::get('uv', ['day' => $day]);
    $uvRes = $uvRes ?? 0;
    $uvRes = (int)$uvRes;
//    $oldUvSum = DailyReportWelfareClubUser::getData();
//    $redis = new \Hhz\Redis\cacheRedis(\hhz\constant\redis\redisKeys::KEY_B_CACHE_DAILY_REPORT_WELFARE_CLUB_USER);

    $redis = new \Hhz\Redis\newCache(\hhz\constant\redis\redisKeys::KEY_B_CACHE_DAILY_REPORT_WELFARE_CLUB_USER);
    $oldUvSum =  $redis->getCache();
    if ($uvRes >= $oldUvSum) {
        $time = date('Y-m-d');
        Log::info($time . '-福利社板块新增住友参与人数' . ':' . $uvRes);
//        DailyReportWelfareClubUser::addData($uvRes);
        $redis->setCache($uvRes);
        echo $time . '-福利社板块新增住友参与人数' . ':' . $uvRes . PHP_EOL;
    } else {
        var_dump(['old' => $oldUvSum, 'new' => $uvRes]);
    }
} catch (\Exception $e) {
    Log::error('好物频道改版 福利社板块新增住友参与人数' . $e);
}

